﻿using UnityEngine;
using System.Collections;

public class Buttercup : MonoBehaviour {

	public float velocityXRange;
	public float velocityYRange;
	public Vector3 direction;
	public Vector3 rotationVector;
	public float rotation;
	public float lifetime = 5.0f;

	// Use this for initialization
	void Start () {
		direction = new Vector3(Random.Range(-velocityXRange, velocityXRange), Random.Range(-velocityYRange, velocityYRange), 0);
		//direction = new Vector3(0, 0, 0);
		rotationVector = new Vector3(0, Random.Range(-rotation, rotation), 0);
		StartCoroutine ("destroyMe");
	}
	
	// Update is called once per frame
	void Update () {
		transform.Translate(direction, Space.World);
		transform.Rotate(rotationVector);
	}

	IEnumerator destroyMe ()
	{
		yield return new WaitForSeconds (lifetime);
		Destroy(this.gameObject);
	}
}
